<template>
  <div class="index_hotal">
    <div class="main_hot common">
      <p class="titleall">实例展示</p>
      <p class="entit">BACKGROUND</p>
      <div class="cont">
        <dl class="flex" v-for="(item, index) in example" :key="index" @click="routexq(item.id)">
          <dt><img :src="item.image" alt="" /></dt>
          <dd>{{ item.title }}</dd>
        </dl>
      </div>
    </div>
    <div class="boxs"></div>

    <div class="main_case common">
      <p class="titleall">合作项目</p>
      <p class="entit">Bcakground</p>
      <div class="swiper1">
        <swiper :options="swiperOption" :not-next-tick="notNextTick" ref="mySwiper">
          <div class="swiper-slide swiper1lide" v-for="(item, index) in cooperate" :key="index">
            <div class="swimg">
              <img :src="item.image" alt="" />
            </div>
          </div>

          <!-- Add Arrows -->
          <div class="swiper-button-prev prev1" slot="button-prev"></div>
          <div class="swiper-button-next next1" slot="button-next"></div>
        </swiper>

        <p class="link">
          <span style="cursor: pointer" @click="casexq()">查看更多实例</span>
        </p>
      </div>
    </div>
    <div class="boxs"></div>
    <div class="panters common">
      <p class="titleall">合作伙伴</p>
      <p class="entit">Coopera</p>
      <!-- 伙伴列表 -->
      <div class="pranflex">
        <dl v-for="(item, index) in friend" :key="index">
          <dt><img :src="item.image" alt="" /></dt>
          <dd>{{ item.title }}</dd>
        </dl>
      </div>
    </div>
  </div>
</template>

<script>
  // import Swiper from "swiper";
  import {
    cases
  } from '@/api'

  export default {
    name: 'HelloWorld',
    props: {
      msg: String
    },
    data() {
      return {
        // 案例展示
        example: [

        ],
        // 合作项目
        cooperate: [

        ],
        // 合作伙伴
        friend: [],
        notNextTick: true,
        swiperOption: {
          slidesPerView: 4,
          spaceBetween: 30,
          slidesPerGroup: 4,
          loop: true,
          loopFillGroupWithBlank: true,

          prevButton: ".swiper-button-prev",
          nextButton: ".swiper-button-next",
        },
      };
    },
    methods: {
      // 跳转实例详情
      routexq(a) {
        console.log(a);
        this.$router.push({
          path: "/Sourexq",
          query: {
            id: a,
            name: 3
          },
        });
      },
      casexq() {
        this.$router.push({
          path: '/Exhibition'
        })
      },

      // 接口
      async getCases() {
        await cases().then((e) => {
          // console.log(e.data);
          this.friend = e.data.friend;
          this.example = e.data.case;
          this.cooperate = e.data.cooperate;
        });
      },
    },
    mounted() {},
    created() {
      this.getCases();
    },
  };

</script>


<style scoped lang="scss">
  .index_hotal {

    // 热门话题
    .main_hot {
      margin: 0 auto;
      // border: 1px solid red;

      padding: 59px 5px 85px 5px;

      .title {
        text-align: center;
        font-size: 28px;
      }

      .entit {
        text-align: center;
        color: #999;
        padding: 10px 0;
        font-size: 18px;
      }

      .cont {
        margin-top: 40px;
        // border: 1px solid red;
        height: 450px;
        display: flex;
        flex-direction: column;
        flex-wrap: wrap;
        justify-content: space-around;

        dl:nth-child(4) {
          // border: 1px solid red;
          width: 700px;
          height: 450px;
          margin-left: 25px;

          dt {
            width: 700px;
            height: 450px;
          }
        }

        dl {
          width: 210px;
          height: 135px;
          position: relative;
          transition: all 0.6s;

          dt {
            width: 210px;
            height: 135px;

            img {
              width: 100%;
              height: 100%;
              object-fit: cover;
            }
          }

          dd {
            position: absolute;
            bottom: 0px;
            text-align: center;
            width: 100%;
            height: 34px;
            border-radius: 5px 5px 0px 0px;
            background-color: rgba(0, 0, 0, 0.5);
            color: #fff;
            line-height: 34px;
          }
        }

        dl:hover {
          transform: scale(1.02);
          box-shadow: 3px 3px 20px #888888;
        }
      }
    }

    // 优秀案例
    .main_case {
      margin: 20px auto;
      // background: url(../assets/bg11.png) no-repeat;
      padding: 79px 0 30px 0;

      // border: 1px solid red;
      .title {
        text-align: center;
        font-size: 28px;
      }

      .entit {
        text-align: center;
        color: #999;
        padding: 10px 0;
        font-size: 18px;
      }

      .swiper1 {

        // border: 1px solid red;
        .link {
          margin-top: 50px;

          span {
            color: #fff;
            width: 214px;
            height: 58px;
            background: #33cfff;
            border-radius: 29px;
            display: block;
            margin: 0 auto;
            text-align: center;
            font-size: 20px;
            line-height: 58px;
          }
        }
      }
    }

    .panters {
      padding: 51px 0 75px 0;
      margin: 0 auto;

      .title {
        text-align: center;
        font-size: 28px;
      }

      .entit {
        text-align: center;
        color: #999;
        padding: 10px 0;
        font-size: 18px;
      }

      .pranflex {
        display: flex;
        justify-content: space-around;
        flex-wrap: wrap;
        text-align: center;

        dl {
          margin-top: 20px;
          width: 18%;

          img {
            width: 100%;
          }
        }
      }
    }
  }

  .boxs {
    width: 1200px;
    height: 38px;
    background: #f7f8fa;
    margin: 0 auto;
  }

  // swiper
  .swimg {
    // width: 300px;
    height: 360px;
    margin: 0 auto;
    transition: all 0.6s;
  }

  .swiper1lide {
    text-align: center;
    padding: 52px 0 20px 0;
  }

  .swiper1lide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .swiper1lide .swimg:hover {
    transform: scale(1.02);
    box-shadow: 3px 3px 20px #888888;
  }

  .swiper-button-prev:after,
  .swiper-button-next:after {
    display: none;
  }

  .swiper-button-prev,
  .swiper-button-next {
    width: 42px;
    height: 42px;
    background: #e0e0e0;
    border-radius: 42px;
  }

  .swiper-button-prev {
    background: url(../assets/fan1.png) no-repeat center #e0e0e0;
  }

  .swiper-button-next {
    background: url(../assets/fan2.png) no-repeat center #e0e0e0;
  }

  .swiper-container {
    width: 95%;
    margin: 0 auto;
    padding: 0 2.5%;
  }

  // swiper end

</style>
